package com.hilon.foundation.para;

import lombok.Data;

import java.util.Date;

@Data
public class FoundationQueryPara {
    private Date dateBegin;
    private Date dateEnd;
    private Date timeQueryBegin;
    private Date timeQueryEnd;
    private String customer;
    private String warehouseNo;
    private String contractNo;
    private String batchNo;
    private String batchNoOriginal;
    private String specification;
    private String steelGradeReal;
    private String thickReal;
    private String steelGradeBom;
    private String thickBom;
    private String priceQueryStr;
    private Double priceMin = 0.0;
    private Double priceMax = Double.MAX_VALUE;
    private String subSystemCustomer;
    private String supplier;
    private String handNoProduct;
    private String handNoMaterial;
    private String settlementDocumentNumber;
    private String yearAndMonth;
    private String workshop;



    public static void formatPara(FoundationQueryPara foundationQueryPara) {
        if (foundationQueryPara.getBatchNo().isEmpty()) foundationQueryPara.setBatchNo("%");
        else foundationQueryPara.setBatchNo("%" + foundationQueryPara.getBatchNo() + "%");
        if (foundationQueryPara.getCustomer().isEmpty()) foundationQueryPara.setCustomer("%");
        else foundationQueryPara.setCustomer("%" + foundationQueryPara.getCustomer() + "%");
        if (foundationQueryPara.getWarehouseNo().isEmpty()) foundationQueryPara.setWarehouseNo("%");
        else foundationQueryPara.setWarehouseNo("%" + foundationQueryPara.getWarehouseNo() + "%");
        if (foundationQueryPara.getContractNo().isEmpty()) foundationQueryPara.setContractNo("%");
        else foundationQueryPara.setContractNo("%" + foundationQueryPara.getContractNo() + "%");
        if (foundationQueryPara.getBatchNoOriginal().isEmpty()) foundationQueryPara.setBatchNoOriginal("%");
        else foundationQueryPara.setBatchNoOriginal("%" + foundationQueryPara.getBatchNoOriginal() + "%");
        if (foundationQueryPara.getSpecification().isEmpty()) foundationQueryPara.setSpecification("%");
        else foundationQueryPara.setSpecification("%" + foundationQueryPara.getSpecification() + "%");
        if (foundationQueryPara.getSupplier().isEmpty()) foundationQueryPara.setSupplier("%");
        else foundationQueryPara.setSupplier("%" + foundationQueryPara.getSupplier() + "%");
        if (foundationQueryPara.getHandNoMaterial().isEmpty()) foundationQueryPara.setHandNoMaterial("%");
        else foundationQueryPara.setHandNoMaterial("%" + foundationQueryPara.getHandNoMaterial() + "%");
        if (foundationQueryPara.getHandNoProduct().isEmpty()) foundationQueryPara.setHandNoProduct("%");
        else foundationQueryPara.setHandNoProduct("%" + foundationQueryPara.getHandNoProduct() + "%");
        if (foundationQueryPara.getYearAndMonth().isEmpty()) foundationQueryPara.setYearAndMonth("%");
        else foundationQueryPara.setYearAndMonth("%" + foundationQueryPara.getYearAndMonth() + "%");
        if (foundationQueryPara.getSettlementDocumentNumber().isEmpty())
            foundationQueryPara.setSettlementDocumentNumber("%");
        else
            foundationQueryPara.setSettlementDocumentNumber("%" + foundationQueryPara.getSettlementDocumentNumber() + "%");
        if (foundationQueryPara.getWorkshop().isEmpty())
            foundationQueryPara.setWorkshop("%");
        else
            foundationQueryPara.setWorkshop("%" + foundationQueryPara.getWorkshop() + "%");
    }
}
